import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ImagePicked extends StatelessWidget {
  final String imageUrl;
  final int index;
  final ValueChanged<int> valueChanged;
  // final String path;
  ImagePicked({this.imageUrl, this.index, this.valueChanged});
  void _handleCancel() {
    valueChanged(index);
  }
  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: Alignment(0.92, -0.92),
      children: <Widget>[
        new FadeInImage.assetNetwork(
          placeholder: "assets/user/load.gif",
          // placeholder: new MemoryImage(kTransparentImage),
          // image: new AssetImage('${path}${imageUrl}'),
          image: this.imageUrl,
          fit: BoxFit.cover,
          width: 64.0,
          height: 64.0,
        ),
        new GestureDetector(
          onTap: _handleCancel,
          child: new Container(
            decoration: new BoxDecoration(
              color: Colors.black45,
              shape: BoxShape.circle,
            ),
            child: new Icon(
              Icons.close,
              color: Colors.white,
              size: 20.0,
            ),
          ),
        )
      ],
    );
  }
}